<template>
	<view>
		<view class="atlas_nav_list">
			<view v-for="(item,index) in atlaslist" class="atlas_list_box" :key="index" @click="listclick(index)" :class="[{'atlas_list_hs':!item.cshow},(current == index&&item.cshow) ? 'atlas_list_active' : '']">
				{{item.name}}
			</view>
		</view>
		<u-toast ref="uToast" />
	</view>

</template>

<script>
	export default {
		data() {
			return {
				current: -1,
				cshow: false,
			}
		},
		props: {
			atlaslist: {
				type: Array,
				default () {
					return []
				}
			},
			atlascont: {
				type: Array,
				default () {
					return []
				}
			}
		},
		watch: {
			atlaslist(newName, oldName) {
				this.current = -1
			}
		},
		methods: {
			listclick(index) {
				this.current = index
				this.$emit('child-event', this.atlaslist[index].id)
				if (this.atlaslist[index].cshow == false)
					this.$refs.uToast.show({
						title: '未开放该区域',
						duration:500,
					})
			}
		}
	}
</script>

<style scoped lang="scss">
	.atlas_nav_list {
		padding: 35rpx 30rpx;
		display: flex;
		flex-wrap: wrap;
		background: #F7F7F7;

		.atlas_list_box {
			width: 142rpx;
			height: 56rpx;
			background: #EDEDED;
			border-radius: 5rpx;
			line-height: 56rpx;
			text-align: center;
			font-size: 24rpx;
			color: #666666;
			margin-top: 26rpx;
			border: 2rpx solid #EDEDED;
			margin-right: 40rpx;

			&:nth-child(4n) {
				margin-right: 0rpx;
			}

			&:nth-child(-n+4) {
				margin-top: 0;
			}
		}
		.atlas_list_hs {
			width: 142rpx;
			height: 56rpx;
			background: #EDEDED;
			border-radius: 5rpx;
			line-height: 56rpx;
			text-align: center;
			font-size: 24rpx;
			color: #9e9e9e;
			margin-top: 26rpx;
			border: 2rpx solid #EDEDED;
			margin-right: 40rpx;
		
			&:nth-child(4n) {
				margin-right: 0rpx;
			}
		
			&:nth-child(-n+4) {
				margin-top: 0;
			}
		}
		
		.atlas_list_active {
			background: #FFFFFF;
			border: 2rpx solid #C40200;
			color: #C40200;
		}

		
	}
</style>
